<* include file=$header_file *>
<script type="text/JavaScript">
	if(parent.$('admincpnav')) parent.$('admincpnav').innerHTML='<* $title*>&nbsp;&raquo;&nbsp;User Management';if(parent.$('add2custom')) parent.$('add2custom').innerHTML='<* $title*>';
</script>
<div class="itemtitle">
  <h3>User Management&nbsp;&raquo;&nbsp;index
    <input  type="button" value="  Refresh " class="btn" onClick="window.location.reload()"/>&nbsp;<input  type="button" value="  Add " class="btn" onClick="window.location.href='/<*$controller*>/add'"/>
  </h3>
</div>
<div id="main_content"> <* $page *>
  <table class="tb tb2 ">
    <tr class="tdhover" >
      <th class="partition">ID</th>
      <th class="partition">Username</th>
      <th class="partition">Name</th>
      <th class="partition">Branch</th>
      <th class="partition">Gender</th>     
	  <th class="partition">Create Time</th>
      <th class="partition">Last Visit Time</th>
      <th class="partition">Login Count</th>
      <th class="partition">Function</th>
    </tr>
    <* foreach from=$result item=item key=key *>
    <tr  class="tdhover">
      <td ><* $item.uid *></td>
      <td ><* $item.username *></td>
      <td ><* $item.name *></td>
      <td ><* $item.branch_name  *></td>
      <td ><* $item.genderDisp *></td>    
      <td ><* $item.create_time *></td>   	  
      <td ><* $item.last_visit_time *></td>
      <td ><* $item.login_num *></td>
      <td ><a href="javascript:edit(<*$item.uid*>)">Edit</a> | <a href="javascript:deleteit(<*$item.uid*>, <* $item.isadmin *>)">Delete</a></td>
    </tr>
    <* /foreach*>
  </table>
  <* $page *> </div>
<script type="text/javascript">

function edit(uid)
{
   window.location='/<*$controller*>/edit/uid/'+uid;
}

function deleteit(uid,isadmin)
{
	if (isadmin != '1')
	{
		if(confirm("Really deleted this record?")){
			window.location='/<*$controller*>/delete/uid/'+uid;
		}
	}
	else
	{
		alert("Admin can not be deleted!");
	}
}

</script>
<* include file=$bottom_file *>